# Author: mosra <mosra@centrum.cz>
pkgname=corrade
pkgver=dev
pkgrel=1
pkgdesc="C++11/C++14 multiplatform utility library"
arch=('i686' 'x86_64')
url="https://magnum.graphics/corrade/"
license=('MIT')
makedepends=('cmake' 'ninja')
options=(!strip)
provides=('corrade-git')

_rootdir=$startdir/../../

build() {
    mkdir -p "$_rootdir/build"
    cd "$_rootdir/build"

    # Disable optimization (saves A LOT of compilation time)
    newcxxflags=$(echo $CXXFLAGS | sed s/-O.//g | sed s/-D_FORTIFY_SOURCE=.//g)
    export CXXFLAGS="$newcxxflags"

    cmake .. \
        -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DBUILD_TESTS=ON \
        -G Ninja
    ninja
}

check() {
    cd "$_rootdir/build"
    CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
}

package() {
    cd "$_rootdir/build"
    DESTDIR="$pkgdir/" ninja install
}
